﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NopSolutions.NopCommerce.BusinessLogic;
using NopSolutions.NopCommerce.BusinessLogic.Categories;
using NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings;
using NopSolutions.NopCommerce.BusinessLogic.SEO;
using NopSolutions.NopCommerce.BusinessLogic.Templates;
using NopSolutions.NopCommerce.Common.Utils;
using NopSolutions.NopCommerce.Common;
using NopSolutions.NopCommerce.BusinessLogic.Infrastructure;

namespace NopSolutions.NopCommerce.Web.Modules
{
  public partial class HomePageProducts1 : BaseNopFrontendUserControl
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!IsPostBack)
        BindData();
    }

    private void BindData()
    {
      var products = this.ProductService.GetAllProductsDisplayedOnHomePage();
      if (products.Count > 0)
      {
        dlProducts.DataSource = products;
        dlProducts.DataBind();
      }
      else
      {
        this.Visible = false;
      }
    }
  }
}